<?php header('Cache-Control: no-store');?>
<head><title>OSA Codeshare system</title>
<script type="text/javascript">
<!--
function check(){
	event.returnValue=false;
	with(document.input){
		if(pwd.value.length==0){
			alert("Password cannot be empty!");return;
		}
	}
	event.returnValue=true;
}
function rdel(i){
	with(document.input){
		if(pwd.value.length==0){
			alert("Password cannot be empty!");return;
		}
		RID.value=i;
		action="/php/delete.php";
		submit();
	}
}
//-->
</script></head>
<?php $UID=$_REQUEST["UID"];
if(!isset($UID)){ ?><body onLoad='alert("Invalid request source");self.history.go(-1);' /> <?php die(); }
$con=mysql_connect("localhost","William");

if (!$con){
	die("MySQL Error " . mysql_error());
}
mysql_select_db("osa", $con); 
$query=mysql_query("SELECT * FROM user WHERE UID=$UID");
if(!$query) die("MySQL Error " . mysql_error());
$rowuser=mysql_fetch_array($query);
if(!$rowuser) die("Internal Error: User #$UID not found");
?>
Welcome to the personal center, <b><?php echo $rowuser["username"]; ?></b>.<br />
<form name="input" action="/php/update.php" method="post" onSubmit="check()">
Nickname:
<input type="text" name="nick" id="nick" maxLength=20 <?php echo "value='". $rowuser["nickname"] . "'"; ?>/>
Old Password*:
<input type="password" name="pwd" id="pwd" maxLength=16 />
New Password:
<input type="password" name="newpwd" id="newpwd" maxLength=16 />
<input type="submit" value="Update" />
<input type="hidden" name="UID" <?php echo "value=$UID"; ?> />
<input type="hidden" name="RID" />
</form>
Files you have uploaded:
<table border = "1">
<tr><th>File name</th><th>Type</th><th>points</th><th>Keywords</th><th>Uploaded on</th><th>Link for Deletion</th></tr>
<?php
$query=mysql_query("SELECT * FROM resource WHERE UID=$UID ORDER BY uploadtime DESC",$con);
if(!$query) die("MySQL Error " . mysql_error());
while($row = mysql_fetch_array($query)){ ?>
<tr><td><?php echo $row["name"]; ?></td><td><?php echo $row["type"]; ?></td>
<td><?php echo $row["points"]; ?></td>
<td><?php echo $row["keywords"]; ?></td><td><?php echo $row["uploadTime"]; ?></td>
<td>
<a href='javascript:;' <?php echo "onClick='rdel(" . $row["RID"] . ");'"; ?>>delete</a>
<?php }?>
</table>
<a href="/php/main.php">Go back to the main page</a>
</body>

